Directory Layout Standards

  • It answers questions like:

    • Where should system configuration go? (/etc)

    • Where should user home directories be? (/home)

    • Where should logs be? (/var/log)

    • Where should executables be installed? (/usr/bin)

  • It says nothing about whether / is on ext4, XFS, Btrfs, or ZFS.

FHS (Filesystem Hierarchy Standard)

  • Linux FHS Explained

  • It is a directory layout specification for Unix-like systems.

  • It defines where files should go within the directory tree, such as:

    • /bin  — essential executables

    • /etc  — system configuration

    • /home  — user home directories

    • /usr  — user applications and libraries

    • /var  — variable data (logs, caches, spools)

    • /tmp  — temporary files

  • The FHS applies regardless of the underlying filesystem. For example, a Linux system using ext4, XFS, ZFS, or F2FS can all present the same FHS directory structure. The filesystem determines how those directories are stored on disk, while the FHS determines what those directories are for.

XDG

  • The XDG Base Directory Specification focuses on per-user files.

  • Instead of applications storing everything directly in ~, it defines locations like:

    ~/.config/
    ~/.local/share/
    ~/.cache/
    ~/.local/state/
    
  • For example:

    ~/.config/nvim/
    ~/.config/git/
    ~/.local/share/Steam/
    ~/.cache/firefox/
    
  • This keeps your home directory cleaner and makes configuration, data, caches, and state easier to manage separately.